package com.mibotiquin.misfarmacos;

import com.mibotiquin.DbHelper.DatabaseItem;

public class ItemFarmaco implements DatabaseItem {
	String idMed;
	String nameMed;
	String useMed;
	String dateIni;
	// private Date dateInit;
	String monthExpiration;
	String yearExpiration;
	String dose;
	String frecuency;
	String imageId;
	String active;
	Integer codUnic;
	String nomLab;

	// SimpleDateFormat formatter = new SimpleDateFormat("dd/mm/yy");
	
	public ItemFarmaco() {
	};

	public ItemFarmaco(String[] data) {
		this.idMed = data[0];
		this.nameMed = data[1];
		this.useMed = data[2];
		this.dateIni = data[3];
		/*
		 * try { this.dateInit = (Date)formatter.parse(data[2]); } catch
		 * (ParseException e) { // TODO Auto-generated catch block
		 * e.printStackTrace(); }
		 */
		this.monthExpiration = data[4];
		this.yearExpiration = data[5];
		this.dose = data[6];
		this.frecuency = data[7];
		this.imageId = data[8];
		this.active = data[9];
		this.codUnic = Integer.valueOf(data[10]);
		if (data[11]== "null"){
			this.nomLab = "Vacio";
		}else{
			this.nomLab = data[11];
		}
	}


	public String[] getCamposArray() {
		String[] res = { "idMed","nameMed", "useMed", "dateIni", "monthExpiration",
				"yearExpiration", "dose", "frecuency", "imageId","active","codUnic", "nomLab" };
		return res;
	}

	/**
	 * Devuelve los datos de los campos ordenados igual que getCamposArray() y
	 * que la bd
	 */
	public String[] getDatosArray() {
		String[] res = { idMed.toString(),nameMed.toString(), useMed.toString(),
				dateIni.toString(), monthExpiration.toString(),
				yearExpiration.toString(), dose.toString(),
				frecuency.toString(), imageId.toString(), active.toString(), codUnic.toString(),nomLab.toString()};
		return res;
	}

	public String getNomLab() {
		return nomLab;
	}

	public void setNomLab(String nomLab) {
		this.nomLab = nomLab;
	}

	/** Devuelve el nombre de la tabla donde se insertara */
	public String getNombreTabla() {
		return "listFarmacos";
	}

	/** Llamada a la constructora que acepta un array de String. */
	public DatabaseItem getInstance(String[] data) {
		return new ItemFarmaco(data);
	}

	public String getIdMed() {
		return idMed;
	}

	public void setIdMed(String idMed) {
		this.idMed = idMed;
	}

	public String getNameMed() {
		return nameMed;
	}

	public void setNameMed(String nameMed) {
		this.nameMed = nameMed;
	}

	public String getUseMed() {
		return useMed;
	}

	public void setUseMed(String useMed) {
		this.useMed = useMed;
	}

	public String getDateIni() {
		return dateIni;
	}

	public void setDateIni(String dateIni) {
		this.dateIni = dateIni;
	}

	public String getActive() {
		return active;
	}

	public void setActive(String active) {
		this.active = active;
	}

	/*
	 * public Date getDateInit() { return dateInit; } public void
	 * setDateInit(Date dateInit) { this.dateInit = dateInit; }
	 */
	public String getMonthExpiration() {
		return monthExpiration;
	}

	public void setMonthExpiration(String monthExpiration) {
		this.monthExpiration = monthExpiration;
	}

	public String getYearExpiration() {
		return yearExpiration;
	}

	public void setYearExpiration(String yearExpiration) {
		this.yearExpiration = yearExpiration;
	}

	public String getDose() {
		return dose;
	}

	public void setDose(String dose) {
		this.dose = dose;
	}

	public String getFrecuency() {
		return frecuency;
	}

	public void setFrecuency(String frecuency) {
		this.frecuency = frecuency;
	}

	public String getImageId() {
		return imageId;
	}

	public void setImageId(String imageId) {
		this.imageId = imageId;
	}

	public Integer getCodUnic() {
		return codUnic;
	}

	public void setCodUnic(Integer codUnic) {
		this.codUnic = codUnic;
	}
}
